﻿<%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl<List<CRM.Database.Model.TrainingsRequests>>" %>
<%@ Import Namespace="CRM.Database.Model" %>
<%@ Import Namespace="CRM.Resourses" %>


<%--<% var statusesCol = new TrainingRequestsStatusesCollection(); %>--%>
<%--<% var schedulesCol = new TrainingsSchedulesCollection(); %>--%>

<% Html.DevExpress().GridView(settings =>
    {
        settings.Name = "gdTrainingsRequest";
        settings.KeyFieldName = "IdTrainingsRequest";
        settings.CallbackRouteValues = new { Controller = "TC", Action = "RequestsReportsPartal" };
        settings.SettingsPager.PageSize = 20;
        settings.Settings.ShowFilterBar = GridViewStatusBarMode.Visible;
        settings.Settings.ShowFilterRow = true;
        settings.Settings.ShowGroupPanel = true;

        //тип учебного курса 1)
        settings.Columns.Add(column =>
        {
            column.Caption = Resourses.TrainingsRequestsType;
            column.FieldName = "RequestType";
        });
        
        //рубрика 2)
        settings.Columns.Add(column =>
        {
            column.Caption = Resourses.TrainingsRubric;
            column.FieldName = "RubricName";
        });
        
        //регион 3)
        settings.Columns.Add(column =>
        {
            column.Caption = Resourses.profineRegion;
            column.FieldName = "profineRegion";
        });
        
        
        //город 4) 
        settings.Columns.Add(column =>
        {
            column.Caption = Resourses.TrainingsCity;
            column.FieldName = "CityName";
        });

        //Название курса 5)
        settings.Columns.Add(column =>
        {
            column.Caption = Resourses.TrainingsCourse;
            column.FieldName = "CourseNameExt";
        });

        //дата курса 5,5)
        settings.Columns.Add(column =>
        {
            column.Caption = Resourses.TrainingsScheduleDate;
            column.FieldName = "CourseDateExt";
            //column.ColumnType = MVCxGridViewColumnType.DateEdit;
        });
        
        //Кол-во дней 6)
        settings.Columns.Add(column =>
        {
            column.Caption = Resourses.TrainingsDuration;
            column.FieldName = "DurationExt";
        });
        
        //Кол-во участников (заявлено) 7)
        settings.Columns.Add(column =>
        {
            column.Caption = Resourses.TrainingsCountRequested;
            column.FieldName = "ParticipantsCountRequested";
        });
        
        //Кол-во участников (фактическое) 8)
        settings.Columns.Add(column =>
        {
            column.Caption = Resourses.TrainingsCountRequested;
            column.FieldName = "ParticipantsCountActual";
        });
        
        //Название компании (Название клиента) 9)
        settings.Columns.Add(column =>
        {
            column.Caption = Resourses.TrainingsCompany;
            column.FieldName = "CompanyExt";
        });
        
        //Стоимость курса 10)
        settings.Columns.Add(column =>
        {
            column.Caption = Resourses.TrainingsCourseCost;
            column.FieldName = "CourseCost";
        });
        
        //номер заявки
        //settings.Columns.Add(column =>
        //{
        //    column.Caption = Resourses.TrainingsRequestNumber; ;
        //    column.FieldName = "IdTrainingsRequest";
        //});

        //дата регистрицаа заявки
        //settings.Columns.Add(column =>
        //{
        //    column.Caption = Resourses.TrainingsRegisterDate;
        //    column.FieldName = "RequestDate";
        //    column.ColumnType = MVCxGridViewColumnType.DateEdit;
        //});

        //контакстное лицо
        //settings.Columns.Add(column =>
        //{
        //    column.Caption = Resourses.TrainingsContactName;
        //    column.FieldName = "ContactNameExt";
        //});

        //контактный телефон
        //settings.Columns.Add(column =>
        //{
        //    column.Caption = Resourses.TrainingsContactPhone;
        //    column.FieldName = "ContactPhoneExt";
        //});

        //email
        //settings.Columns.Add(column =>
        //{
        //    column.Caption = Resourses.TrainingsContactEmail;
        //    column.FieldName = "ContactEmailExt";
        //});

        //комментарии
        //settings.Columns.Add(column =>
        //{
        //    column.Caption = Resourses.TrainingsComments;
        //    column.FieldName = "Comments";
        //});

        //Статус заявки
        //settings.Columns.Add(column =>
        //{
        //    column.FieldName = "IdTrainingsRequestsStatus";
        //    column.Caption = Resourses.TrainingRequestsStatus;
        //    column.ColumnType = MVCxGridViewColumnType.ComboBox;
        //    var comboBoxProperties = column.PropertiesEdit as ComboBoxProperties;
        //    if (comboBoxProperties != null)
        //    {
        //        comboBoxProperties.DataSource = statusesCol.TrainingRequestsStatusesActiveList;
        //        //comboBoxProperties.DataSource = DB.GetLocalizedTrainingRequestsStatusesNames(Thread.CurrentThread.CurrentCulture.ToString());
        //        comboBoxProperties.TextField = "LocalizedName";
        //        comboBoxProperties.ValueField = "IdTrainingRequestsStatus";
        //        comboBoxProperties.ValueType = typeof(int);
        //    }
        //});

        //settings.Columns.Add(column =>
        //{
        //    column.FieldName = "IdTrainingsSchedule";
        //    column.Caption = Resourses.TrainingsScheduleDate;
        //    column.ColumnType = MVCxGridViewColumnType.ComboBox;
        //    column.PropertiesEdit.DisplayFormatString = "MMM/d/yyyy";
        //    var comboBoxProperties = column.PropertiesEdit as ComboBoxProperties;
        //    if (comboBoxProperties != null)
        //    {
        //        comboBoxProperties.DisplayFormatString = "MMM/d/yyyy";
        //        comboBoxProperties.DisplayFormatInEditMode = true;
        //        comboBoxProperties.DataSource = schedulesCol.TrainingsSchedulesList;
        //        comboBoxProperties.TextField = "PlannedDate";
        //        comboBoxProperties.ValueField = "IdTrainingsSchedule";
        //        comboBoxProperties.ValueType = typeof(int);
        //        comboBoxProperties.TextFormatString = "MMM/d/yyyy";
        //    }
        //});
        
    }).Bind(Model).GetHtml();%>